<!-- 普通登录 -->
<template>
  <div v-show="show == 1">
    <div
      class="input_line input_phone clear"
      :class="{ active: curFocus == 'phone' }"
    >
      <input
        class="fl"
        type="text"
        name="phoneNumber"
        @focus="curFocus = 'phone'"
        @blur="curFocus = ''"
        v-model.trim="send.phoneNumber"
        placeholder="输入手机号"
      />
    </div>
    <div
      class="input_line input_password clear"
      :class="{ active: curFocus == 'password' }"
    >
      <input
        class="fl"
        :type="display ? 'text' : 'password'"
        @focus="curFocus = 'password'"
        @blur="curFocus = ''"
        name="password"
        v-model.trim="send.password"
        placeholder="输入6～20位密码（区分大小写）"
        @keyup.enter="$emit('submit')"
      />
      <label class="fr" for="password" @click="display = !display">
        <i
          class="icon"
          :class="{ 'sp-bukejian': !display, 'sp-kejian-copy': display }"
        ></i>
      </label>
    </div>
    <div class="clear check">
      <div class="fl">
        <input type="checkbox" :checked="auto == 1" @change="autoLogin" /><span
          >自动登录</span
        >
      </div>
      <div class="fr">
        <input
          type="checkbox"
          :checked="rember == 1"
          :disabled="auto == 1"
          @change="remember"
        /><span>记住密码</span>
      </div>
    </div>
  </div>
</template>

<script>
import { getLocal } from "../script/fn";
import { commonLogin } from "../mixinsv2.1.0/commonLogin";
export default {
  mixins: [commonLogin],
  props: {
    show: {
      default: 0,
      type: Number,
    },
  },
  data() {
    return {
      display: 0,
      curFocus: "",
      send: {
        phoneNumber: getLocal("phoneNumber"),
        password: getLocal("password"),
      },
      auto: !!+getLocal("autoLogin"),
      rember: !!+getLocal("remember"),
    };
  },
  watch: {
    "send.phoneNumber"() {
      this.disable();
    },
    "send.password"() {
      this.disable();
    },
    show() {
      this.disable();
    },
  },
  components: {},

  computed: {},

  mounted() {},
};
</script>
<style lang="scss" scoped>
.input_line {
  width: 279px;
  height: 40px;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  box-sizing: border-box;
  transition: all 0.3s;
  &.active {
    border: 1px solid #888888;
    input {
      color: #333333;
    }
  }
  label {
    text-align: center;
    height: 100%;
    width: 40px;
    &::after {
      content: "";
      display: inline-block;
      width: 0;
      height: 100%;
      vertical-align: middle;
    }
    .icon {
      display: inline-block;
      vertical-align: middle;
    }
  }
  input {
    box-sizing: border-box;
    font-size: 14px;
    color: #474747;
    height: 38px;
    padding-left: 9px;
    line-height: 38px;
    background: transparent;
    outline: none;
    border: none;
  }
}
.input_phone {
  margin-bottom: 20px;

  input {
    width: 100%;
  }
}
.input_password {
  &.active {
    .icon.sp-mima_nor {
      background-position: 0px -240px;
    }
  }
  input {
    width: 200px;
  }
  label:last-child {
    cursor: pointer;
  }
}
.check {
  font-size: 16px;
  font-weight: 400;
  padding-top: 12px;
  color: #888888;
  input {
    position: relative;
    top: 2px;
    margin-right: 5px;
    cursor: pointer;
  }
}
</style>
